package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class TravelQuery extends QueryObject {
    private int perExpendType = -1;
    private int travelTimeType = -1;
    private int dayType = -1;
    private Integer state;
    private int orderType = 1;
    private String keyword;
    private Long userId;

    @Override
    public String getOrderBy(){
        if(this.orderType == 1){
            return "releaseTime desc";
        }else {
            return "viewNum desc";
        }
    }

    public TravelCondition getPerExpends(){
        return TravelCondition.TRAVEL_PER_EXPENDS.get(this.perExpendType);
    }

    public TravelCondition getTravelTime(){
        return TravelCondition.TRAVEL_TIME.get(this.travelTimeType);
    }

    public TravelCondition getDays(){
        return TravelCondition.TRAVEL_DAYS.get(this.dayType);
    }
}
